package com.ruoyi.project.wf.enums;

import java.util.HashMap;
import java.util.Map;

public enum WfProcessInstStatus {
	// 工作项状态（100－创建，200－已获取，300－已完成，99－挂起，999－取消)
	Created(100, "启动"),

	Suspend(998, "挂起"), Finished(300, "已完成"),

	Deleted(999, "取消");

	public static WfProcessInstStatus toArcBatchStatus(Integer value) {
		return codeMap.get(value);
	}

	public static String getNameByCode(Integer value) {
		WfProcessInstStatus status = codeMap.get(value);
		if (status != null) {
			return status.getName();
		}
		return "未知状态";
	}

	private static Map<Integer, WfProcessInstStatus> codeMap;
	private static Map<String, WfProcessInstStatus> nameMap;
	static {
		codeMap = new HashMap<Integer, WfProcessInstStatus>();
		nameMap = new HashMap<String, WfProcessInstStatus>();
		for (WfProcessInstStatus status : WfProcessInstStatus.values()) {
			codeMap.put(status.getValue(), status);
			nameMap.put(status.getName(), status);
		}
	}
	private Integer value;
	private String name;

	private WfProcessInstStatus(int value, String name) {
		this.value = value;
		this.name = name;
	}

	public int getValue() {
		return value;
	}

	public String getName() {
		return name;
	}

	public String toString() {
		return this.getValue() + "-" + this.getName();
	}

	public static void main(String[] args) {
		for (WfProcessInstStatus status : WfProcessInstStatus.values()) {
			//System.out.println(status);
		}
	}
}
